﻿@using INNOVACALL.Framework.Common
@using InnovaApp.Layers.ResourcesLayer.Properties
@{
    string StyleBundleBase = string.Empty;
    InnovaApp.Layers.CommonLayer.Models.ViewModels.LayoutViewModels._LayoutViewModels_Base layoutModel =
        (InnovaApp.Layers.CommonLayer.Models.ViewModels.LayoutViewModels._LayoutViewModels_Base)Model;
    string JQueryUITheme = InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.JQueryUITheme;
    bool CustomTheme = JQueryUITheme.ToLower() != "base";
    //if (CustomTheme)
    //{
    //    StyleBundleBase = string.Format(@"~/Content/themes/{0}", JQueryUITheme);
    //}
    string MyPrettyCMSContentPageWidth = string.Format("{0}px", InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.ContentMinWidth);
    string divMenuContainerTopMargin = string.Format("{0}px", InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.MenuTopMargin);
    string adminModeCSSClass = (layoutModel._AdminMode ? "adminMode" : "");
    
    string cssPreMenuToAdd = string.Empty;
    string cssMenuToAdd = string.Empty;
    string cssPostMenuToAdd = string.Empty;
    string cssPreMenuDisplay = string.Empty;
    string cssPostMenuDisplay = string.Empty;
    string cssDivContent = string.Empty;
    
    cssPreMenuToAdd = (bool.Parse(InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.DynamicSettings["sp_DisplayPreMenu"]) ? string.Format(".premenu{{height:{0}px;width:{1}px;}}", InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.DynamicSettings["sp_PreMenuHeight"], InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.ContentMinWidth) : "");
    cssMenuToAdd = string.Format(".menu{{width:{0}px;}}", InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.ContentMinWidth);
    cssPostMenuToAdd = (bool.Parse(InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.DynamicSettings["sp_DisplayPostMenu"]) ? string.Format(".postmenu{{height:{0}px;width:{1}px;}}", InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.DynamicSettings["sp_PostMenuHeight"], InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.ContentMinWidth) : "");
    cssPreMenuDisplay = (!bool.Parse(InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.DynamicSettings["sp_DisplayPreMenu"]) ? "notDisplayed" : "");
    cssPostMenuDisplay = (!bool.Parse(InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.DynamicSettings["sp_DisplayPostMenu"]) ? "notDisplayed" : "");
    
    int sp_ContentBodyPaddingTop = int.Parse(InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.DynamicSettings["sp_ContentBodyPaddingTop"]);
    int sp_ContentBodyPaddingLeft = int.Parse(InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.DynamicSettings["sp_ContentBodyPaddingLeft"]);
    int sp_ContentBodyPaddingRight = int.Parse(InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.DynamicSettings["sp_ContentBodyPaddingRight"]);
    int sp_ContentBodyPaddingBottom = int.Parse(InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.DynamicSettings["sp_ContentBodyPaddingBottom"]);
    
    cssDivContent = string.Format(
@"
        #divBody{{
            min-height:{4}px;
            width:{5}px;
        }}
        #MyPrettyCMSContentPage{{
            width:{5}px;
        }}
        #divBody{{
            padding-top : {0}px;
            padding-left : {1}px;
            padding-right : {2}px;
            padding-bottom : {3}px;
            width:{6}px;
        }}
",
sp_ContentBodyPaddingTop,
sp_ContentBodyPaddingLeft,
sp_ContentBodyPaddingRight,
sp_ContentBodyPaddingBottom,
InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.ContentMinHeight,
InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.ContentMinWidth,
InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.ContentMinWidth - (sp_ContentBodyPaddingLeft + sp_ContentBodyPaddingRight)
);
}
<!DOCTYPE html>
<html lang="en" class="siteBackground">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    @foreach (var item in layoutModel._Meta)
    { 
        <meta name="@item.Key.ToString()" content="@item.Value" />
    }
    <title>@layoutModel._PageTitle</title>
    <link href="@Url.Content("~/CSSG/Site.css")" rel="stylesheet" type="text/css" />
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <!--Bundle Manager-->
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/jqueryui")
    @Scripts.Render("~/bundles/jqueryplugins")
    @Scripts.Render("~/bundles/jqueryballoon")
    @if (layoutModel._UsesKendoUI)
    {
        @Scripts.Render("~/bundles/kendoui")
    }
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/bundles/views")


    <link rel="stylesheet" href="/Content/themes/base/minified/jquery-ui.min.css">
    @if (CustomTheme)
    { 
        <link rel="stylesheet" href="/Content/themes/@InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.JQueryUITheme/jquery-ui-1.9.2.custom.min.css">
    }


    @if (layoutModel._UsesKendoUI)
    {
        @Styles.Render("~/Content/clientComponents/KendoUI/css")
    }
    <!--/Bundle Manager-->
    @if (layoutModel._SpecificCSS != null)
    {
        foreach (var cssReference in layoutModel._SpecificCSS)
        { 
        <link href="@Url.Content("~/Content/" + cssReference)" rel="stylesheet" type="text/css" />
        }
    }
    @if (layoutModel._externalCss != null)
    {
        foreach (var cssReference in layoutModel._externalCss)
        { 
        <link href="@cssReference" rel="stylesheet" type="text/css" />
        }
    }
    @if (layoutModel._externalJs != null)
    {
        foreach (var jsReference in layoutModel._externalJs)
        { 
        <script src="@Url.Content(jsReference)" type="text/javascript"></script>
        }
    }
    @foreach (var jsReference in layoutModel._SpecificJS)
    { 
        <script src="@Url.Content("~/Scripts/" + jsReference)" type="text/javascript"></script>
    }
    @if (!InnovaApp.Portals.MVC4Portal.Controllers.PortalEnvironment.JQueryUIRoundedCorners)
    {
        <style type="text/css">
            .ui-corner-all {
                border-radius: 0px!important;
                -moz-border-radius-bottomright: 0px!important;
                -moz-border-radius-bottomleft: 0px!important;
                -moz-border-radius-topright: 0px!important;
                -moz-border-radius-topleft: 0px!important;
            }
        </style>                        
    }
    <style type="text/css" id="StyleContentWrapper">
        @cssPreMenuToAdd
        @cssMenuToAdd
        @cssPostMenuToAdd
        @cssDivContent
    </style>
</head>
<body>
    <div id="divMceRibbonBarPlaceholder" class="notDisplayed">
        <span class="mceEditor defaultSkin">
            <table class="mceLayout">
            </table>
        </span>
    </div>
    @Html.Hidden("hidOpeningMessage", layoutModel._PageMessage, new { @Id = "hidOpeningMessage" })
    <div class="myprettycms wholePage @adminModeCSSClass">
        <div class="myprettycms premenu content-wrapper @adminModeCSSClass @cssPreMenuDisplay">
            <div class="float-left">
                <section id="LanguageSelector">
                    @Html.Partial("_LanguageSelector", layoutModel._Languages)
                </section>
            </div>
            <div class="float-right">
                <section id="login">
                    @Html.Partial("_LoginPartial", layoutModel._Languages.SelectedLanguage)
                </section>
            </div>
            <div class="myprettycms premenucontent content-wrapper">
            </div>
        </div>
        <div class="myprettycms menu content-wrapper">
            @if (layoutModel._DisplayMenus)
            { 
                <nav>
                    <div id="divMenuBar">
                        @Html.Partial("_MenuBar", layoutModel._Menus)
                    </div>
                    <div class="layoutMenuCache">
                    </div>
                </nav>
            }
        </div>
        <div class="myprettycms postmenu content-wrapper @cssPostMenuDisplay">
        </div>
        <!--KendoUI Add-->
        <style scoped>
            #customValue {
                line-height: 16px;
                width: 60px;
                float: none;
                margin: -3px 0 0 5px;
            }
        </style>
        <!--/KendoUI Add-->
        @if (IsSectionDefined("StructurePageEditor"))
        {
            <div class="divStructurePageEditor notDisplayed">
                @RenderSection("StructurePageEditor")
            </div> 
        }
        <div id="MyPrettyCMSContentPage" class="content-wrapper full-height page shadow">
            <div id="divBody">
                @RenderBody()
            </div>
        </div>

        <div class="notDisplayed" id="SingleFileUploadDialogDiv">
            @using (Html.BeginForm("", "SingleFileUpload", FormMethod.Post, new { id = "SingleFileUploadForm", enctype = "multipart/form-data", target = "SingleFileUploadIFrame" }))
            { 
                <input type="file" id="SingleFileUploadFileInput" name="SingleFileUploadFileInput" class="ui-autocomplete-input ui-widget-content ui-corner-all" />    
                <input type="hidden" name="SingleFileUploadImageToUpdateIdHidden" id="SingleFileUploadImageToUpdateIdHidden" />
                <input type="submit" id="SingleFileUploadSubmitButton" />
            }
            <iframe class="notDisplayed" name="SingleFileUploadIFrame"></iframe>
        </div>
    </div>
    <footer>
        <div class="FooterCopyright">
            <a href="http://www.innovacall.com">&copy; INNOVACALL 2012</a>
        </div>
        <div class="FooterLogoMyPrettyCMS">
            <a href="http://www.innovacall.com" target="_blank">
                <img src="/Images/LogoInnovacallMyPrettyCMS.png" alt="Done with Innovacall My Pretty CMS" />
            </a>
        </div>
    </footer>
</body>
@if (layoutModel._SpecificJqueryJS != null)
{
    foreach (var specificJqueryJSReference in layoutModel._SpecificJqueryJS)
    {
        string prefix = string.Empty;
        if (!specificJqueryJSReference.StartsWith("http"))
        {
            prefix = "~/Scripts/";
        }
    <script src="@Url.Content(prefix + specificJqueryJSReference)" type="text/javascript"></script>
    }
}
@if (layoutModel._DynamicJqueryJS != null)
{
    foreach (var dynamicJqueryJS in layoutModel._DynamicJqueryJS)
    { 
    <script src="@Url.Content("~" + dynamicJqueryJS)" type="text/javascript"></script>
    }
}
@Html.Raw(@"<script type=""text/javascript"">")
@Html.Raw(string.Format(@"var uiLanguage='{0}';", System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToLower()))
@{
    
    foreach (string variable in layoutModel._JSVariables)
    {
    @Html.Raw(variable);
    }
}
@Html.Raw(@"$(document).ready(function () {")
@Html.Raw(@"	$.fn.DocReady();")
@Html.Raw(@"});")
@Html.Raw(@"</script>")
</html>
